import { useReactive } from "ahooks";
import { useModel } from "umi";
import { useEffect } from "react";
import compress from "gql-compress";

const useAllOrders = () => {
    const { graphqlFetch } = useModel("global");

    const state = useReactive({
        ordersLoading: false,
        orders: [],
    });

    const loadAllOrders = async () => {
        state.ordersLoading = true;
        // let res = await graphqlFetch({
        //     query,
        //     variables: {},
        // });
        // let commodities = res?.a?.nodes || [];
        let orders = [0, 1, 3, 3, 3, 3, 3]
        state.orders = orders;
        state.ordersLoading = false;
        // return commodities;
    };

    return { ...state, loadAllOrders };
};

//通过订单状态，订单客户姓名，订单客户电话，订单所属员工，订单所属分享客户，订单发生时间，订单所属门店查询订单
//需要查询到订单的基本信息，商品清单，服务清单，物流明细，相关的退单信息
const query = compress(``);

export default useAllOrders;
